package com.zhaoc.dao;

import com.zhaoc.domain.system.Permission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * <p>title:com.zhaoc.dao</p>
 * date:2018/8/21 0021
 * time:18:12
 * author:赵成
 * user:13566
 */
public interface PermissionRepository extends JpaRepository<Permission,Integer> {

    @Query("from Permission p inner join fetch p.roles r inner join fetch r.users u where u.id=?1")
    List<Permission> findByUser(int id);
}
